--Stored Proc
--Select All Course Registrations based on input registration
CREATE PROCEDURE CourseRegistrationCourseSearch
@CourseId VARCHAR(20) = '%'
AS
BEGIN
DECLARE @SCourseId VARCHAR(20) = '%'+@CourseId+'%';
	SELECT 
		CregId,
		S.AutoId AS StudentAutoID,
		UIN,
		S.FirstName,
		S.LastName,
		C.AutoId AS CourseAutoId,
		C.CourseId,
		C.Name AS [Course]
	FROM 
		CourseRegistration CR INNER JOIN Student S  ON CR.StudentAutoId = S.AutoId
		INNER JOIN Course C ON C.AutoId = CR.CourseAutoId
	WHERE
	C.CourseId  like @SCourseId
	Order By UIN;
END;




